
Import('env')

env.Library(
    target='field_path',
    source=[
        'field_path.cpp',
        ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/util/foundation',
        ]
    )

env.CppUnitTest(
    target='field_path_test',
    source='field_path_test.cpp',
    LIBDEPS=[
        'field_path',
        ],
    )

env.Library(
    target='document_value',
    source=[
        'document.cpp',
        'value.cpp',
        ],
    LIBDEPS=[
        'field_path',
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/util/foundation',
        '$BUILD_DIR/mongo/util/intrusive_counter',
        ]
    )

env.CppUnitTest(
    target='document_value_test',
    source='document_value_test.cpp',
    LIBDEPS=[
        'document_value',
        ],
    )

env.CppUnitTest(
    target='document_source_test',
    source='document_source_test.cpp',
    LIBDEPS=[
        'document_source',
        '$BUILD_DIR/mongo/db/service_context',
        ],
    )

env.Library(
    target='dependencies',
    source=[
        'dependencies.cpp',
        ],
    LIBDEPS=[
        'document_value',
        'field_path',
    ]
)

env.Library(
    target='expression',
    source=[
        'expression.cpp',
        ],
    LIBDEPS=[
        'dependencies',
        'document_value',
    ]
)

env.Library(
    target='accumulator',
    source=[
        'accumulator.cpp',
        'accumulator_add_to_set.cpp',
        'accumulator_avg.cpp',
        'accumulator_first.cpp',
        'accumulator_last.cpp',
        'accumulator_min_max.cpp',
        'accumulator_push.cpp',
        'accumulator_std_dev.cpp',
        'accumulator_sum.cpp',
        ],
    LIBDEPS=[
        'document_value',
        'expression',
        'field_path',
    ]
)

docSourceEnv = env.Clone()
docSourceEnv.InjectThirdPartyIncludePaths(libraries=['snappy'])
docSourceEnv.Library(
    target='document_source',
    source=[
        'document_source.cpp',
        'document_source_geo_near.cpp',
        'document_source_group.cpp',
        'document_source_index_stats.cpp',
        'document_source_limit.cpp',
        'document_source_lookup.cpp',
        'document_source_match.cpp',
        'document_source_merge_cursors.cpp',
        'document_source_mock.cpp',
        'document_source_out.cpp',
        'document_source_project.cpp',
        'document_source_redact.cpp',
        'document_source_sample.cpp',
        'document_source_sample_from_random_cursor.cpp',
        'document_source_skip.cpp',
        'document_source_sort.cpp',
        'document_source_unwind.cpp',
        ],
    LIBDEPS=[
        'accumulator',
        'dependencies',
        'document_value',
        'expression',
        '$BUILD_DIR/mongo/client/clientdriver',
        '$BUILD_DIR/mongo/db/matcher/expressions',
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/db/storage/wiredtiger/storage_wiredtiger_customization_hooks',
        '$BUILD_DIR/third_party/shim_snappy',
    ],
    LIBDEPS_TAGS=[
        # Inclusion of sorter.cpp causes a dependency on mongo::isMongos,
        # which is not uniquely defined
        'incomplete'
    ],

)

env.Library(
    target='pipeline',
    source=[
        'pipeline.cpp',
        ],
    LIBDEPS=[
        'dependencies',
        'document_source',
        'document_value',
        '$BUILD_DIR/mongo/db/auth/authorization_manager_global',
        '$BUILD_DIR/mongo/db/auth/authcore',
        '$BUILD_DIR/mongo/db/repl/read_concern_args',
    ]
)

env.CppUnitTest(
    target='agg_expression_test',
    source='expression_test.cpp',
    LIBDEPS=[
        'accumulator',
        'expression',
        ],
    )

env.CppUnitTest(
    target='accumulator_test',
    source='accumulator_test.cpp',
    LIBDEPS=[
        'accumulator',
        ],
    )

env.CppUnitTest(
    target='pipeline_test',
    source='pipeline_test.cpp',
    LIBDEPS=[
        'pipeline',
        '$BUILD_DIR/mongo/db/auth/authorization_manager_mock_init',
        '$BUILD_DIR/mongo/db/service_context',
        ],
    )
